﻿<!--
    Form used for new Payments. 
    Copyright (C) 2014 Daniel Hamacher

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
 -->
<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:callisto="using:Callisto.Controls"
    xmlns:local="using:SpendingMonitor.Views"
    xmlns:common="using:SpendingMonitor.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Models="using:SpendingMonitor.Models"
    x:Name="pageRoot"
    x:Class="SpendingMonitor.Views.NewPaymentPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Mode=Self}}"
    mc:Ignorable="d"
    NavigationCacheMode="Disabled">

    <Page.Resources>
        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="40*"/>
            <ColumnDefinition Width="37*"/>
            <ColumnDefinition Width="1289*"/>
        </Grid.ColumnDefinitions>
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="99*"/>
            <RowDefinition Height="57*"/>
            <RowDefinition Height="472*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid Grid.ColumnSpan="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
				Style="{StaticResource NavigationBackButtonNormalStyle}"
				VerticalAlignment="Top"
				AutomationProperties.Name="Back"
				AutomationProperties.AutomationId="BackButton"
				AutomationProperties.ItemType="Navigation Button"/>
            <TextBlock x:Name="PageTitle" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
				IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40" Text="New Payment Entry"/>
        </Grid>
        <Canvas Grid.Column="1" HorizontalAlignment="Left" Height="628" Grid.Row="1" VerticalAlignment="Top" Width="1326" Grid.RowSpan="3" Grid.ColumnSpan="2" Margin="0,5,0,-5">
            <callisto:CustomDialog x:FieldModifier="public" x:Name="NewPropertyDialog" Background="Black" BackButtonVisibility="Visible" IsOpen="False">
                <StackPanel Width="700" Orientation="Vertical">
                    <StackPanel Width="700" Orientation="Vertical">
                        <TextBlock x:Name="Instruction" Margin="0,0,10,10" FontSize="14.6667" FontWeight="SemiLight" TextWrapping="NoWrap"/>
                        <TextBox x:Name="Value" Margin="0,0,10,10" FontSize="14.6667" FontWeight="SemiLight" Width="500" />
                        <TextBlock x:Name="RetailInstruction" Margin="0,0,10,10" FontSize="14.6667" FontWeight="SemiLight" TextWrapping="NoWrap"/>
                        <TextBox x:Name="RetailValue" Margin="0,0,10,10" FontSize="14.6667" FontWeight="SemiLight" Width="500" />                        
                    </StackPanel>
                    <Button Content="OK" Width="90" Margin="0,0,20,0" Click="SaveNewPropertyFromDialogButton_Click" />
                </StackPanel>
            </callisto:CustomDialog>
            <ComboBox Canvas.Left="74" Canvas.Top="40" Width="267" x:Name="Category" SelectionChanged="Category_SelectionChanged" />
            <ComboBox  x:Name="Retailer" Canvas.Left="74" Canvas.Top="150" Width="267"/>
            <ComboBox x:Name="PaymentMethod" Canvas.Left="74" Canvas.Top="256" Width="267"/>
            <Button Content="New Category" Canvas.Left="418" Canvas.Top="37" Width="196" x:Name="NewCategory" Click="NewPropertyButton_Click"/>
            <Button Content="Add Retailer" Canvas.Left="418" Canvas.Top="147" Width="196" x:Name="AddRetailer" Click="NewPropertyButton_Click"/>
            <Button Content="New Payment Method" x:Name="NewPaymentMethod" Canvas.Left="418" Canvas.Top="253" Width="196" Click="NewPropertyButton_Click"/>
            <TextBlock Canvas.Left="74" TextWrapping="Wrap" Canvas.Top="314" Width="125">
				<Run Text="Date: "/>
				<LineBreak/>
				<Run/>
            </TextBlock>
            <DatePicker Canvas.Left="74" Canvas.Top="340" Width="323" x:Name="PayedOn"/>
            <Button Content="Save Payment" Canvas.Left="276" Canvas.Top="497" Height="78" Width="210" x:Name="SavePayment" Click="SaveNewPaymentButton_Click" />
            <callisto:NumericUpDown DecimalPlaces="2" Minimum="0" Maximum="10000" x:Name="Price" Canvas.Left="74" Canvas.Top="429" Width="267" Height="37" FontSize="16"/>
            <TextBlock Canvas.Left="74" TextWrapping="Wrap" Canvas.Top="230" Width="125">
            	<Run Text="Payment Method: "/>
            	<LineBreak/>
            	<Run/>
            </TextBlock>
            <TextBlock Canvas.Left="74" TextWrapping="Wrap" Canvas.Top="119" Width="125">
            	<Run Text="Retailer: "/>
            	<LineBreak/>
            	<Run/>
            </TextBlock>
            <TextBlock Canvas.Left="74" TextWrapping="Wrap" Canvas.Top="14" Width="125">
            	<Run Text="Category: "/>
            	<LineBreak/>
            	<Run/>
            </TextBlock>
            <TextBlock Canvas.Left="74" TextWrapping="Wrap" Canvas.Top="398" Width="125">
            	<Run Text="Price: "/>
            	<LineBreak/>
            	<Run/>
            </TextBlock>
        </Canvas>
    </Grid>
</Page>
